﻿' 加载全局数据表

DataTable.ImportSheet "C:\Path\To\DataSheet.xlsx", "Sheet1", dtGlobalSheet
Dialog("Login").WaitProperty "visible", True, 10000

' 登录模块
Dialog("Login").WinEdit("Agent Name:").Set DataTable("AgentName", dtGlobalSheet)
Dialog("Login").WinEdit("Password:").SetSecure DataTable("Password", dtGlobalSheet)
Dialog("Login").WinButton("OK").Click

' 航班预订模块
Window("Flight Reservation").WinObject("Date of Flight:").Type DataTable("FlightDate", dtGlobalSheet)

' 插入文本检查点：检查 "Fly From" 是否包含期望值
Window("Flight Reservation").WinComboBox("Fly From:").Select DataTable("FlyFrom", dtGlobalSheet)
Window("Flight Reservation").WinComboBox("Fly From:").Check CheckPoint("Fly From:")

Window("Flight Reservation").WinComboBox("Fly To:").Select DataTable("FlyTo", dtGlobalSheet)
Window("Flight Reservation").WinComboBox("Fly To:").Check CheckPoint("Fly To:")

' 点击航班按钮
Window("Flight Reservation").WinButton("FLIGHT").Click

' 插入图像检查点：检查飞机图像是否正确
Window("Flight Reservation").WinObject("Plane Image").Check CheckPoint("Plane Image")

' 确认航班并填写乘客信息
Window("Flight Reservation").Dialog("Flights Table").WinButton("OK").Click
Window("Flight Reservation").WinEdit("Name:").Set DataTable("PassengerName", dtGlobalSheet)
Window("Flight Reservation").WinButton("Insert Order").Click

' 检查订单完成后弹出的确认窗口
If Window("Flight Confirmation").Exist(10) Then
    Reporter.ReportEvent micPass, "Flight Booking", "Flight successfully booked for " & DataTable("PassengerName", dtGlobalSheet)
Else
    Reporter.ReportEvent micFail, "Flight Booking", "Flight booking failed for " & DataTable("PassengerName", dtGlobalSheet)
End If
